//
//  main.cpp
//  Practice10
//
//  Created by 赵世杰 on 2020/7/11.
//  Copyright © 2020 zhaoshijie. All rights reserved.
//

#include <iostream>
#include "BankAccountClass.hpp"
#include "PersonClass.hpp"
#include "golf.hpp"
#include "NameSP.hpp"
#include "MoveClass.hpp"
//#include "StackClass.hpp"
#include "BetelgeuseanClass.hpp"
#include "ListClass.hpp"

using namespace std;

int main(int argc, const char * argv[]) {
    // insert code here...
    std::cout << "Hello, World!\n";
    
    
    /*
    
    //  1、
    
    BankAccount *bank = new BankAccount();
    
    stpcpy(bank->name, "zhaoshijie");
    (*bank).account = 123895812395;
    bank->money = 1000000;
    
    (*bank).showBankInfo();
    
    
    
    BankAccount bank2 ;
    stpcpy(bank2.name, "shijie");
    bank2.account = 909478829;
    bank2.money = 10000000;
    bank2.showBankInfo();
     
     */
    
    
    /*
    
    //  2、
    
    Person one;
    Person two("Smythecraft");
    Person three("Dimwiniddy","Sam");
    
    
    cout << endl;
    
    one.Show();
    one.FormalShow();
    
    cout << endl;
    
    two.Show();
    two.FormalShow();
    
    cout << endl;
    
    three.Show();
    three.FormalShow();
    
    cout << endl;
    
     */
    
    
    /*
     
    //  3、
    
    
    char *name = "zhaoshijie";
    
    int hc = 26;
    
    Golf gl(name,hc);
    
    gl.showgolf();
    */
    
    
    /*
    
    // 4、
    double ar[] = {100,200,300,400};
    
    Sales sales = Sales(ar, sizeof(ar)/sizeof(ar[0]));
    
    sales.showSales();
    
    */
    
    
    /*
    
    // 5、
    
    Stack st;
    char ch;
    char name[35];
    double payment = 0.0;
    cout << "Please enter A to add a purchase order,\n"
    << "P to process a PO, or Q to quit.\n";
    
    while (cin >> ch && toupper(ch)!='Q')
    {
        while (cin.get() != '\n')
        {
            continue;
        }
        
        if(!isalpha(ch))
        {
            cout << "\a";
            continue;
        }
        
        switch (ch) {
            case 'A':
            case 'a':
            {
                cout << "Enter a fullName to add: ";
                cin.getline(name, 25);
                cout << "Enter a payment to add: ";
                cin >> payment;
                cout << endl;
                if(st.isfull())
                {
                    cout << "stack already full\n";
                }
                else
                {
                    Customer custer;
                    strcpy(custer.fullname, name);
                    custer.payment = payment;
                    
                    st.push(custer);
                }
                
            }
                break;
            case 'P':
            case 'p':
            {
                if(st.isempty())
                {
                    cout << "stack already empty\n";
                }
                else
                {
                    Customer custer;
                    strcpy(custer.fullname, name);
                    custer.payment = payment;
                    
                    st.pop(custer);
                    cout << "Payment #" << custer.payment << "popped\n";
                }
            }
        
                
            default:
                break;
        }
        
        cout << "Please enter A to add a purchase prder,\n"
        << "P to process a PO , or Q to quit.\n";
        
    }
    
    cout << "Bye\n";
    
    */
    
    
    /*
     
    // 6、
    Move mo = Move(1,2);
    
    mo.showMove();
    
    Move mo2 = Move(2,3);
    
    Move newMo = mo.add(mo2);
    
    newMo.showMove();
    
    mo.reset(2,2);
    
    mo.showMove();
    */
    
    
    /*
     
    // 7、
    
    Betelgeusean bete = Betelgeusean("小世界");
    bete.show();
    
    bete.changeCI(26);
    bete.show();

    bete.setDefaultName();
    bete.show();
     
    */
    
    List st;
        char ch;
        Item item;
        cout << "Please enter A to add a item,\n"
            << "P to process a list,S to show the list, or Q to quit.\n";
        while (cin >> ch && toupper(ch) != 'Q')
        {
            while (cin.get() != '\n')
                continue;
            if (!isalpha(ch))
            {
                cout << '\a';
                continue;
            }
            switch(ch)
            {
                 case 'A':
                 case 'a': if (st.isfull())
                               cout << "list already full\n";
                           else
                               cout<<"Enter a item: ";
                               cin >> item;
                               st.add(item);
                           break;
                 case 'P':
                 case 'p': if (st.isempty())
                               cout << "list already empty\n";
                           else {
                               st.visit(db);
                               cout<<"Every item has doubled.\n";
                           }
                           break;
                 case 'S':
                 case 's':
                           st.showList();
                           break;
            }
            cout << "Please enter A to add a item,\n"
                << "P to process a list,S to show the list, or Q to quit.\n";
        }
        st.showList();
        cout << "Bye\n";
    
    
    return 0;
    
}
